#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <QListWidgetItem>
#include "toolbar.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ToolBar *bar=new ToolBar(ui->splitter);
    ui->splitter->addWidget (bar);

    notewidget = new NoteWidget(this);
    secondPageWidget = new QWidget;
    thirdPageWidget = new QWidget;

    stackedWidget = new QStackedWidget(this);
    stackedWidget->addWidget(notewidget);
    stackedWidget->addWidget(secondPageWidget);
    stackedWidget->addWidget(thirdPageWidget);

    ui->splitter->addWidget (stackedWidget);
    ui->splitter->setSizes (QList<int>()<<80<<9999999);
    ui->splitter->setStretchFactor (1,1);

    connect(bar, SIGNAL(note_button_checked()),this, SLOT(onnote_buttonclicked()));
    connect(bar, SIGNAL(url_button_checked()),this, SLOT(onurl_buttonclicked()));
    connect(bar, SIGNAL(dropbox_button_checked()),this, SLOT(ondropbox_buttonclicked()));

}

void MainWindow::onnote_buttonclicked()
{
    stackedWidget->setCurrentWidget (notewidget);
}

void MainWindow::onurl_buttonclicked()
{
    stackedWidget->setCurrentWidget (secondPageWidget);
}

void MainWindow::ondropbox_buttonclicked()
{
    stackedWidget->setCurrentWidget (thirdPageWidget);
}

MainWindow::~MainWindow()
{
    delete ui;
}


